<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title>用户协议&隐私政策</title>
		<meta content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=no" name="viewport" />
		<style type="text/css">
			* {
				margin: 0;
				padding: 0;
			}

			textarea {
				border: none;
				width: 100vw;
				height: 100vh;
				box-sizing: border-box;
				padding: 20px;
				background-color: #FFFFFF;
				color: #333333;
				font-size: 14px;
				line-height: 20px;
			}
		</style>
	</head>
	<body>
		<textarea disabled="true" id="div"></textarea>
	</body>
</html>
<script type="text/javascript">
	const url = 'https://test.hegao.net/freight/freight/login/getConfig'

	function parseQueryString(url) {
		const urlKey = url.split('?')[1]
		const objKeyValue = {}
		if (!urlKey) return objKeyValue
		const urlObj = urlKey.split('&')
		for (let i = 0; i < urlObj.length; i++) {
			objKeyValue[urlObj[i].split('=')[0]] = decodeURI(urlObj[i].split('=')[1])
		}
		return objKeyValue
	}
	const urlParams = parseQueryString(window.location.href)
	/* url转字符串 */
	const httpRequest = new XMLHttpRequest() //第一步：创建需要的对象
	httpRequest.open('POST', url,
		true) //第二步：打开连接/***发送json格式文件必须设置请求头 ；如下 - */
	httpRequest.setRequestHeader('Content-type',
		'application/json') //设置请求头 注：post方式必须设置请求头（在建立连接后设置请求头
	httpRequest.send(JSON.stringify({
		type: urlParams.type || 3
	})) //发送请求 将json写入send中
	// 获取数据后的处理程序

	httpRequest.onreadystatechange = function() { //请求后的回调接口，可将请求成功后要执行的程序写在其中
		console.log(httpRequest)
		if (httpRequest.readyState == 4 && httpRequest.status == 200) { //验证请求是否发送成功
			const res = JSON.parse(httpRequest.responseText) //获取到服务端返回的数据
			if (res.success) {
				document.getElementById('div').value = res.data.content
			}
		}
	}
</script>
<!-- <script type="module">
	import
	config
	from '../../config/config.js'
	function parseQueryString(url) {
		const urlKey = url.split('?')[1]
		const objKeyValue = {}
		if (!urlKey) return objKeyValue
		const urlObj = urlKey.split('&')
		for (let i = 0; i < urlObj.length; i++) {
			objKeyValue[urlObj[i].split('=')[0]] = decodeURI(urlObj[i].split('=')[1])
		}
		return objKeyValue
	}
	const urlParams = parseQueryString(window.location.href)
	/* url转字符串 */
	const httpRequest = new XMLHttpRequest() //第一步：创建需要的对象
	httpRequest.open('POST', config.host + '/freight/login/getConfig',
		true) //第二步：打开连接/***发送json格式文件必须设置请求头 ；如下 - */
	httpRequest.setRequestHeader('Content-type',
		'application/json') //设置请求头 注：post方式必须设置请求头（在建立连接后设置请求头
	httpRequest.send(JSON.stringify({
		type: urlParams.type || 3
	})) //发送请求 将json写入send中
	// 获取数据后的处理程序
	alert(config.host + '/freight/login/getConfig')
	httpRequest.onreadystatechange = function() { //请求后的回调接口，可将请求成功后要执行的程序写在其中
		console.log(httpRequest)
		if (httpRequest.readyState == 4 && httpRequest.status == 200) { //验证请求是否发送成功
			const res = JSON.parse(httpRequest.responseText) //获取到服务端返回的数据
			if (res.success) {
				document.getElementById('div').value = res.data.content
			}
		}
	}
</script> -->
